package com.test.fundible.fundible_09_setting;

import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.test.fundible.R;
import com.test.fundible.fundible_03_login.LoginAc_fundibletivity;
import com.test.fundible.fundible_00_http.OkHttpUtil;
import com.test.fundible.fundible_00_utils.FundibleUtil;


public class Log_fundibleoutDia_fundiblelog extends Dialog {

    private final String page_fundible = "DIALOG_LOGOUT";
    public String clSP="";
    public String bEI2="";
    public String b4Li="";
    public String i5wR="";

    public Log_fundibleoutDia_fundiblelog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_fundible_logout);

        getWindow().setBackgroundDrawableResource(R.color.transparent);
        setCanceledOnTouchOutside(true);
        getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        setI5wR("Gwioeee");
        initView_fundible();
    }

    @SuppressLint("SetTextI18n")
    private void initView_fundible(){

        setClSP("Giojkerwe");

        findViewById(R.id.dlo_tv_cancel).setOnClickListener(v -> {
            OkHttpUtil.getInstance_fundible().uploadEventPoint(page_fundible,"CANCEL_CLICK","");
            dismiss();
        });

        findViewById(R.id.dlo_tv_logout).setOnClickListener(v -> {

            OkHttpUtil.getInstance_fundible().uploadEventPoint(page_fundible,"LOGOUT_CLICK","");

            FundibleUtil.clear_fundible();
            FundibleUtil.clearState_fundible();

            dismiss();

            Intent intent = new Intent(getContext(), LoginAc_fundibletivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
            getContext().startActivity(intent);

        });

    }

    @Override
    public void show() {
        super.show();
        setB4Li("Hawer");
        OkHttpUtil.getInstance_fundible().uploadEventPoint(page_fundible,"START","");
    }

    @Override
    public void dismiss() {
        setbEI2("ghwaierjer");
        super.dismiss();
        OkHttpUtil.getInstance_fundible().uploadEventPoint(page_fundible,"END","");

    }

    public void setClSP(String clSP) {
        this.clSP = clSP;
    }

    public void setbEI2(String bEI2) {
        this.bEI2 = bEI2;
    }

    public void setB4Li(String b4Li) {
        this.b4Li = b4Li;
    }

    public void setI5wR(String i5wR) {
        this.i5wR = i5wR;
    }
}
